# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Brand',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='名称', max_length=20)),
                ('logo', models.ImageField(verbose_name='Logo图片', upload_to='')),
                ('first_letter', models.CharField(verbose_name='品牌首字母', max_length=1)),
            ],
            options={
                'verbose_name': '品牌',
                'verbose_name_plural': '品牌',
                'db_table': 'tb_brand',
            },
        ),
        migrations.CreateModel(
            name='GoodsCategory',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='名称', max_length=10)),
                ('parent', models.ForeignKey(verbose_name='父类别', blank=True, null=True, related_name='subs', to='goods.GoodsCategory')),
            ],
            options={
                'verbose_name': '商品类别',
                'verbose_name_plural': '商品类别',
                'db_table': 'tb_goods_category',
            },
        ),
        migrations.CreateModel(
            name='GoodsChannel',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('url', models.CharField(verbose_name='频道页面链接', max_length=50)),
                ('sequence', models.IntegerField(verbose_name='组内顺序')),
                ('category', models.ForeignKey(verbose_name='顶级商品类别', to='goods.GoodsCategory')),
            ],
            options={
                'verbose_name': '商品频道',
                'verbose_name_plural': '商品频道',
                'db_table': 'tb_goods_channel',
            },
        ),
        migrations.CreateModel(
            name='GoodsChannelGroup',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='频道组名', max_length=20)),
            ],
            options={
                'verbose_name': '商品频道组',
                'verbose_name_plural': '商品频道组',
                'db_table': 'tb_channel_group',
            },
        ),
        migrations.CreateModel(
            name='SKU',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='名称', max_length=50)),
                ('caption', models.CharField(verbose_name='副标题', max_length=100)),
                ('price', models.DecimalField(verbose_name='单价', max_digits=10, decimal_places=2)),
                ('cost_price', models.DecimalField(verbose_name='进价', max_digits=10, decimal_places=2)),
                ('market_price', models.DecimalField(verbose_name='市场价', max_digits=10, decimal_places=2)),
                ('stock', models.IntegerField(verbose_name='库存', default=0)),
                ('sales', models.IntegerField(verbose_name='销量', default=0)),
                ('comments', models.IntegerField(verbose_name='评价数', default=0)),
                ('is_launched', models.BooleanField(verbose_name='是否上架销售', default=True)),
                ('default_image_url', models.CharField(verbose_name='默认图片', max_length=200, blank=True, null=True, default='')),
                ('category', models.ForeignKey(verbose_name='从属类别', on_delete=django.db.models.deletion.PROTECT, to='goods.GoodsCategory')),
            ],
            options={
                'verbose_name': '商品SKU',
                'verbose_name_plural': '商品SKU',
                'db_table': 'tb_sku',
            },
        ),
        migrations.CreateModel(
            name='SKUImage',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('image', models.ImageField(verbose_name='图片', upload_to='')),
                ('sku', models.ForeignKey(verbose_name='sku', to='goods.SKU')),
            ],
            options={
                'verbose_name': 'SKU图片',
                'verbose_name_plural': 'SKU图片',
                'db_table': 'tb_sku_image',
            },
        ),
        migrations.CreateModel(
            name='SKUSpecification',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
            ],
            options={
                'verbose_name': 'SKU规格',
                'verbose_name_plural': 'SKU规格',
                'db_table': 'tb_sku_specification',
            },
        ),
        migrations.CreateModel(
            name='SpecificationOption',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('value', models.CharField(verbose_name='选项值', max_length=20)),
            ],
            options={
                'verbose_name': '规格选项',
                'verbose_name_plural': '规格选项',
                'db_table': 'tb_specification_option',
            },
        ),
        migrations.CreateModel(
            name='SPU',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='名称', max_length=50)),
                ('sales', models.IntegerField(verbose_name='销量', default=0)),
                ('comments', models.IntegerField(verbose_name='评价数', default=0)),
                ('desc_detail', models.TextField(verbose_name='详细介绍', default='')),
                ('desc_pack', models.TextField(verbose_name='包装信息', default='')),
                ('desc_service', models.TextField(verbose_name='售后服务', default='')),
                ('brand', models.ForeignKey(verbose_name='品牌', on_delete=django.db.models.deletion.PROTECT, to='goods.Brand')),
                ('category1', models.ForeignKey(verbose_name='一级类别', related_name='cat1_spu', on_delete=django.db.models.deletion.PROTECT, to='goods.GoodsCategory')),
                ('category2', models.ForeignKey(verbose_name='二级类别', related_name='cat2_spu', on_delete=django.db.models.deletion.PROTECT, to='goods.GoodsCategory')),
                ('category3', models.ForeignKey(verbose_name='三级类别', related_name='cat3_spu', on_delete=django.db.models.deletion.PROTECT, to='goods.GoodsCategory')),
            ],
            options={
                'verbose_name': '商品SPU',
                'verbose_name_plural': '商品SPU',
                'db_table': 'tb_spu',
            },
        ),
        migrations.CreateModel(
            name='SPUSpecification',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('name', models.CharField(verbose_name='规格名称', max_length=20)),
                ('spu', models.ForeignKey(verbose_name='商品SPU', related_name='specs', to='goods.SPU')),
            ],
            options={
                'verbose_name': '商品SPU规格',
                'verbose_name_plural': '商品SPU规格',
                'db_table': 'tb_spu_specification',
            },
        ),
        migrations.AddField(
            model_name='specificationoption',
            name='spec',
            field=models.ForeignKey(verbose_name='规格', related_name='options', to='goods.SPUSpecification'),
        ),
        migrations.AddField(
            model_name='skuspecification',
            name='option',
            field=models.ForeignKey(verbose_name='规格值', on_delete=django.db.models.deletion.PROTECT, to='goods.SpecificationOption'),
        ),
        migrations.AddField(
            model_name='skuspecification',
            name='sku',
            field=models.ForeignKey(verbose_name='sku', related_name='specs', to='goods.SKU'),
        ),
        migrations.AddField(
            model_name='skuspecification',
            name='spec',
            field=models.ForeignKey(verbose_name='规格名称', on_delete=django.db.models.deletion.PROTECT, to='goods.SPUSpecification'),
        ),
        migrations.AddField(
            model_name='sku',
            name='spu',
            field=models.ForeignKey(verbose_name='商品', to='goods.SPU'),
        ),
        migrations.AddField(
            model_name='goodschannel',
            name='group',
            field=models.ForeignKey(verbose_name='频道组名', to='goods.GoodsChannelGroup'),
        ),
    ]
